﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using fmtx.Framework.Model;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System.Net;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;

namespace SocketServer
{
    public class SocketBean:BaseBean
    {
        public SocketBean()
        {
            Cid = ObjectId.GenerateNewId().ToString();
        }

        public SocketBean(Socket _socket,string _name):this()
        {
            Ipaddress = (_socket.RemoteEndPoint as IPEndPoint).Address.ToString();
            Port = (_socket.RemoteEndPoint as IPEndPoint).Port;
            Name = _name;
            IsOnline = true;
        }

        [BsonId]
        public string Cid { get; set; }

        public string Name { get;set; }

        public string Ipaddress { get; set; }

        public int Port { get; set; }

        public bool IsOnline { get; set; }
    }
}
